#ifndef DIRECTORY_JS
#define DIRECTORY_JS

#include "File.js"

var Directory = function(/* XmlNode */ node)
{
	/* Not possible with 'xml2js' parser... */
	/*if (node.namespace() == null ||
		node.namespace().href() != "http://objective-javascript.googlecode.com/files/Ojsproj.xsd")
	{
		throw "Invalid file.";
	}*/
	
	var /* Directory[] */ _directories = new Array();
	var /* File[] */ _files = new Array();
	
	var /* string */ _name;
	
	(function()
	{
		if(node.Directory != undefined)
		{
			for(var i = 0; i < node.Directory.length; i++)
			{
				_directories.push(new Directory(node.Directory[i]));
			}
		}
		
		if(node.File != undefined)
		{
			for(var i = 0; i < node.File.length; i++)
			{
				_files.push(new File(node.File[i]));
			}
		}

		if(node.Name != undefined)
		{
			_name = node.Name;
		}
		else
		{
			throw "Missing required attribute 'Name'.";
		}
	})();
	
	this.__defineGetter__("Directories", function() { return _directories; });
	this.__defineGetter__("Files", function() { return _files; });
	this.__defineGetter__("Name", function() { return _name; });
};

#endif
